t
Your First Class*0151*

In object-oriented terms, a class is an abstract description of a collection of similar objects. Objects *761*have two components: their attributes *88*and their methods. If we were to create a class for humans, we might call the class Person, since a group of people is made up of individual persons. People generally share similar physical features—arms, legs, eyes, hair. They each have an age, height, and weight. In addition, people widely display similar know-how—speech, walking, sleeping, laughing, and so on.

In object-oriented programming terminology*903*, we refer to individual people as instances  *495*of class Person. Their physical features are their attributes. The various things people know how to do are called their methods.*709* 

___________________________________________________________
NOTE: You can think of the class description as a mold from which new instances of the class are cast. Once created, each instance of a class can have a unique set of values assigned to its attributes. A newly born Person object could be assigned yellow hair, a weight of seven pounds, and a vocabulary of zero words. Other Person instances can have different values for their hair, weight, age, and vocabulary. But all instances of the same class have the same set of attributes and the same methods. Attribute values can be modified. So in a year the newborn can weigh 23 pounds and have a vocabulary of 20 words.

If you are still uncomfortable with terms like “class,” “instance,” “attribute,” and “method,” don’t worry. Chapter 4, “Conceptual Foundations,” in this manual provides a detailed discussion of background ideas and specialized terminology fundamental to Prograph.
-----------------------------------------------------------

Creating a new class, setting its attributes, and creating its methods is easy in Prograph.*93*

u
Click the close box to dismiss the greetings case window.

u Click in the Classes window *162*to activate it, and then Command-click anywhere within the white space of the window. An unnamed class icon appears. 

Congratulations! You have created your first Prograph class.*883*

Your new class is currently just an abstract description of a class of featureless objects that do not know how to do anything.

u Type Person to give the class a name.

Adding an attribute is just as easy. 

Notice that the *406*hexagonal class icon *0155*is divided into left and right halves. The triangular shape in the left half represents the attributes of the class. The rectangular shapes stacked in the right half of the *407*class icon represent the methods*719*, the know-how, of the class.

u Double-click on the left side of the class icon to open the Attributes window of the Person class. The window opens with an attribute icon *84*followed by the name of the class in the title bar.

u Notice the horizontal fuzzy gray line (green on color monitors) in the Attributes window*95*. 
Command-click in the Person Attributes window, anywhere below the gray line. An unnamed triangle-shaped attribute icon with a NULL (unspecified) value appears where you clicked. The blinking insertion bar below the new icon prompts you for a name to identify this attribute.

u Type name to identify this attribute for class Person.

Individual people—“instances” *496*in object-oriented terms—created as members of class Person now have one attribute, name. Each Person object created can have a unique value assigned to this attribute. name thus becomes the characteristic by which you can tell individual persons apart.*85*

___________________________________________________________________________________________________________________________________________
NOTE: name is the only attribute of the Person class that you use in this chapter of the Grand Tour. Other likely attributes for members of class Person are age, weight, and hair color. You can click below the name attribute icon and add other attributes if you wish, although they are not used during the Grand Tour.
-----------------------------------------------------------

u Click the close box to dismiss the Person Attributes window.